{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0225d301-7d47-4661-b3f7-fbd3f50c13c7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting git+https://github.com/sympy/sympy.git\n",
      "  Cloning https://github.com/sympy/sympy.git to /tmp/pip-req-build-1qj7zv8a\n",
      "  Running command git clone -q https://github.com/sympy/sympy.git /tmp/pip-req-build-1qj7zv8a\n",
      "Collecting mpmath>=0.19\n",
      "  Downloading mpmath-1.2.1-py3-none-any.whl (532 kB)\n",
      "\u001b[K     |████████████████████████████████| 532 kB 311 kB/s eta 0:00:01\n",
      "\u001b[?25hBuilding wheels for collected packages: sympy\n",
      "  Building wheel for sympy (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for sympy: filename=sympy-1.9.dev0-py3-none-any.whl size=6126842 sha256=26067d9d5c7eefbbeef7c13b2ad836e713cd8e0a2880732b827d62acef019324\n",
      "  Stored in directory: /tmp/pip-ephem-wheel-cache-y20g3p4b/wheels/2a/63/67/6faabf0ee91cc4123af027c1092f9a87b40222f8ff20bb80d2\n",
      "Successfully built sympy\n",
      "Installing collected packages: mpmath, sympy\n",
      "Successfully installed mpmath-1.2.1 sympy-1.9.dev0\n"
     ]
    }
   ],
   "source": [
    "!pip3 install git+https://github.com/sympy/sympy.git"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fbd4383c-b283-4f08-ac74-320cf9a53364",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c630bd56-8880-4f05-8aee-e2f4d5ef3f06",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "35133716-47c7-46cd-b9ab-06a4fa3fbb52",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import symbols, Eq, solve"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "aade1582-ef48-4180-9573-2b6f24c65184",
   "metadata": {},
   "outputs": [],
   "source": [
    "x, y = symbols('x y')\n",
    "\n",
    "equation = Eq(2+x, 10) # 2 + x = 10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "198c2d1f-91a3-4540-95f7-9f84d066da4c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{x: 8}]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve(equation, dict=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "21e0ea9a-c07c-4d28-929e-f769a33d44ec",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "896478e7-fa5f-4c74-b16d-8d97fa4ba37e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "dffa7c27-0c0e-475c-82c7-b7877124ae37",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.solvers.inequalities import solve_univariate_inequality"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "a190d799-8480-4477-8a3b-056787046b0a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-\\infty < x \\wedge x < -2\\right) \\vee \\left(2 < x \\wedge x < \\infty\\right)$"
      ],
      "text/plain": [
       "((-oo < x) & (x < -2)) | ((2 < x) & (x < oo))"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve_univariate_inequality(x**2 > 4, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "c76dd3f9-1310-430a-ae56-3c7947894ef4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 < x \\wedge x < 3$"
      ],
      "text/plain": [
       "(2 < x) & (x < 3)"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve([\n",
    "    x > 2,\n",
    "    x + 1 < 4,\n",
    "], x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ea739de7-3c80-442a-a661-99e096811d66",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
